The output Element

The output element is used to display a result from the scripts or form controls. It contains three main properties for, form, and name.

Let’s do the following steps to display output.


<!DOCTYPE html>
<html>
<head>
<title>The output Element</title>
<script type=”text/javascript”>
    Function cal()
    {
    X=10;
    Y=3;
    Z=x+y*x-y;
    document.form1.sum.vallue=”hello… The calculated value is : “ + z;
    }
</script>
</head>
<body onload=”cal()”>
<center>
    <h2> Example of output element</h2>
    <h4>Generate output on the load of web page</h4>
    <form name=”form1”>
    <b> <output name=”sum”></output></b>
    </form>
</center>
</body>
</html>

Save the document with the name Output.html and open on browser.